<?php
class Application_Form_Link extends Zend_Form{

	public function __construct($options = null)
	{
		parent::__construct($options);
		$this->setName('link');

		$categories = new Zend_Form_Element_Select('category_id');
		//$categoryDB = new Application_Model_DbTable_Category();
		$categories->setLabel('Categories:')
			->setRequired(true);
		$categories->addMultiOptions(Application_Model_RssReaderApi::getCategoriesAssoc());
		$this->addElements(array($categories));

//		$this->addElement('select', 'category_id', array(
//            'required'   => true,
//            'label'      => 'Categories:',
//			'addMultiOptions' => Application_Model_RssReaderApi::getCategoriesAssoc()
//		));
		

		$this->addElement('text', 'title', array(
            'filters'    => array('StringTrim'),
            'required'   => true,
            'label'      => 'Rss title:',
		    'validators' => array(
				array('NotEmpty',true),
				array('StringLength', false, array(3, 20))
            ),
		));

		$this->addElement('text', 'url', array(
            'filters'    => array('StringTrim'),
            'required'   => true,
            'label'      => 'Url:',
		    'validators' => array(
				array('NotEmpty',true)
//                array('Hostname', false, array()),
            ),
		));


		$this->addElement('submit','submit', array(
            'required' => false,
            'ignore'   => true,
            'label'    => 'submit'
            ));
	}

}
